<include file="__THEME__/header" />



<link href="../Public/basic.css" rel="stylesheet" type="text/css" />

<div class="content"><!-- 内容 begin  -->

<include file="__THEME__/apps" />


<div class="main"> <!-- 右侧内容 begin  -->
<div class=page_title> <!-- page_title begin -->
    <h2><img src="../Public/images/contacts.gif" />修改资料</h2>
<div class="c"></div>
</div><!-- page_title end -->
<div class="tab-menu"><!-- 切换标签 begin  -->
    <ul>
        <li><a href="__URL__"><span>基本资料</span></a></li>
        <li><a href="__URL__/intro" class="on"><span>个人情况</span></a></li>
        <li><a href="__URL__/contact"><span>联系方式</span></a></li>
        <li><a href="__URL__/education"><span>教育情况</span></a></li>
        <li><a href="__URL__/career"><span>工作情况</span></a></li>
        <li><a href="__URL__/face"><span>上传头像</span></a></li>
    </ul>
  </div><!-- 切换标签 end  -->
  <div class="data"><!-- 个人情况 begin  -->
    <php>if($_GET["t"] == 1){</php><center><b><font color="red">修改成功！</font></b></center> <php>}</php>
<form action="__URL__/doIntro" method="post" class="form_validator" onsubmit="return check()">

    <ul>
      <li class="btmline mb10 cGray2"><div class="left alR" style="width: 15%;">&nbsp;</div><div class="left" style="width: 50%;">&nbsp;</div><div class="left" style="width: 20%;">谁可以看见</div><div class="left" style="width: 15%;">在首页显示</div></li>

  


        <volist name="item" id="vo">
          <li>
          <div class="left alR" style="width: 15%;">{$vo.display}：</div><div class="left" style="width: 50%;">
            <input type="text" id="old_{$vo['name']}" class="TextH20" style="width:300px;" onfocus="this.className='Text2'" onblur="this.className='TextH20'"  name="{$vo.name}" value="<php>echo $info[$vo['name']];</php>"/>
          </div>
          <div class="left" style="width: 20%;">
                    <select id="old_privacy_{$vo.name}" name="__privacy_{$vo.name}">
                        <option value="0"  <php>if($privacy[$vo["name"]] == 0){</php> selected='true' <php>}</php>>任何人</option>                       <option value="1"  <php>if($privacy[$vo["name"]] == 1){</php> selected='true' <php>}</php>>仅好友</option>                  <option value="2"  <php>if($privacy[$vo["name"]] == 2){</php> selected='true' <php>}</php>>私密</option>
                    </select>
                </div>
                <div class="left" style="width: 15%;">
                  <input id="old_display_{$vo.name}" name="__display_{$vo.name}" type="checkbox" value="1" <php>if($display[$vo["name"]] == 1){</php> checked="true" <php>}</php>/>
                </div>
            </li>
        </volist>

        <php>foreach($add_more as $k=>$vo){</php>
         <li class="btmline">
                <div class="left alR" style="width: 15%;">
                  <input name="more_item[{$k}]" type="text" value="{$vo['name']}" class="TextH20 addMore" id="old_more_{$vo['name']}_{$k}" style="width:90px" onBlur="this.className='TextH20 addMore'" onFocus="this.className='Text2 addMore'" />：</div>
                  <div class="left" style="width: 50%;">
                    <input name="more_con[{$k}]" type="text" id="old_more_{$vo['name']}" value="{$vo['value']}" class="TextH20 addMore" style="width:300px;" onfocus="this.className='Text2 addMore'" onblur="this.className='TextH20 addMore'" />
                </div>

                <div class="left" style="width: 20%;">
                  <select id="old_more_privacy_{$vo['name']}" name="__privacy_more[{$k}]">
                        <option value="0" <php>if($vo["privacy"] == 0){</php> selected='true' <php>}</php> >任何人</option>
                        <option value="1" <php>if($vo["privacy"] == 1){</php> selected='true' <php>}</php> >仅好友</option>
                        <option value="2" <php>if($vo["privacy"] == 2){</php> selected='true' <php>}</php> >私密</option>
                    </select>
                </div>

                <div class="left" style="width: 15%;">
                  <input id="old_more_display_{$vo['name']}" name="__display_more[{$k}]" type="checkbox" value="1" class="is_display" <php>if($vo["display"] == 1){</php> checked="true" <php>}</php> />
                </div>
            </li>
        <php>}</php>
		</ul>
<php>$k=$k+1;</php>
        <ul id="more_list">
            <li id="more_info">
                <div class="left alR" style="width: 15%;">
                <input name="more_item[{$k}]" type="text" class="TextH20 item addMore" id="textfield7" style="width:90px" onBlur="this.className='TextH20 addMore item'" onFocus="this.className='Text2 item addMore' " onkeyup="change2( $( this ) )"/>：</div>
				<div class="left" style="width: 50%;">
                <input name="more_con[{$k}]" type="text" id="textfield6" class="TextH20 addMore" style="width:300px;" onfocus="this.className='Text2 addMore'" onblur="this.className='TextH20 addMore'"  onkeyup="change( $( this ) )" />
                </div>
                <div class="left" style="width: 20%;">
                  <select name="__privacy_more[{$k}]" class="__privacy">
                        <option value="0">任何人</option>
                        <option value="1">仅好友</option>
                        <option value="2">私密</option>
                    </select>
                </div>
                <div class="left" style="width: 15%;">
                    <input name="__display_more[{$k}]" type="checkbox" value="1" class="is_display"/>
                </div>
            </li>
            
			
        </ul>
		<ul>
        <li  class="topline">
        <div class="left alR" style="width: 15%;">&nbsp;</div><div class="left" style="width: 50%;">
            <input type="submit" class="btn_b" value="保存修改" />
            <input type="button" class="btn_b" value="添 加" onclick="add_more({$k})" />
        </div>
        <div class="left" style="width: 20%;">&nbsp;</div><div class="left" style="width: 15%;">&nbsp;</div></li>
</ul>

</form>
</div><!-- 个人情况 end  -->


</div><!-- 右侧内容 end  -->


<div class="c"></div>
</div><!-- 内容 end -->

<script>
var key=0;
var hasChange = false;
var hasChange2 = false;
var addMore = false;
    //添加更多
function add_more(k){
		if(key==0) key = k+1;
        var more = $("#more_info").clone().find(".TextH20").val("").end().find(".item").attr("name",'more_item['+key+']').end().find('.tcon').attr('name','more_con['+key+']').end().find(".__privacy").attr("name",'__privacy_more['+key+']').end().find(".is_display").attr("checked",false).attr("name",'__display_more['+key+']').end();
        $("#more_list").append(more);
        key=key+1;
        addMore = true;
}

function change(_this){
  if(_this.val() != "") {
    hasChange = true;
  }else{
    hasChange = false;
  }
}

function change2(_this){
  if(_this.val() != "") {
    hasChange2 = true;
  }else{
    hasChange2 = false;
  }
}

function check(){
  //if( key !=0  ) return true;


  var item = $("#more_info").find(".item").val();
  var con = $("#more_info").find(".tcon").val();
  var nochange3 = true;
  if( item && con ) nochange3 = false;

  var nochange2 = false;
  <php>foreach( $add_more as $key=>$value ){</php>
    var old_more_{$value['name']} = "{$value['value']}";
    var old_more_privacy_{$value['name']} = "{$value['privacy']}";
    var old_more_display_{$value['name']} = "{$value['display']}";
  <php>}</php>

    <php>foreach( $add_more as $key=>$value ){</php>
      if( $( "#old_more_{$value['name']}" ).val() == old_more_{$value['name']} &&  $( "#old_more_privacy_{$value['name']}" ).val()  == old_more_privacy_{$value['name']} &&  $( "#old_more_display_{$value['name']}" ).attr( 'checked' )  == old_more_display_{$value['name']}  && $( "#old_more_{$value['name']}_{$key}" ).val() == "{$value['name']}")
  <php>}</php>
  nochange2 = true;

  <php>foreach( $item as $value ){</php>
    var old_{$value['name']}         = "{$info[$value['name']]}";
    var old_privacy_{$value['name']} = "{$privacy[$value['name']]}";
    var old_display_{$value['name']} = "{$display[$value['name']]}";
  <php>}</php>

  var nochange = false;
  <php>foreach( $item as $value ){</php>
    if( $( "#old_{$value['name']}" ).val() == old_{$value['name']} &&  $( "#old_privacy_{$value['name']}" ).val()  == old_privacy_{$value['name']} &&  $( "#old_display_{$value['name']}" ).attr( 'checked' )  == old_display_{$value['name']} )
  <php>}</php>
    nochange = true;
  
  if( (nochange && nochange2 && nochange3)){

	if($('.addMore:last').val() != ''){
		return true;	
	}

	  
    Alert( "没有修改任何值" );
    return false;
  }else{
    return true;
  }
}
</script>
<include file="__THEME__/footer" />

